package com.aipanda.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 序列号类
 * 
 * @param type 序列号类型
 * @param lastValue 计数
 * @author wanyuxiang
 * 
 */
@Entity
@Table(name = "aipanda_sn")
public class Sn extends BaseEntity {
	private static final long serialVersionUID = -2330598144835706164L;
	private Type type;
	private Long lastValue;

	/**
	 * 序列号类型类
	 * 
	 * @param product 产品类型
	 * @param order 订单类型
	 * @param payment 付款类型
	 * @param refunds 退款类型
	 * @param shipping 运输类型
	 * @param returns 退货类型
	 * @author wanyuxiang
	 * 
	 */
	public enum Type {
		product, order, payment, refunds, shipping, returns;
	}

	@Column(nullable = false, updatable = false, unique = true)
	public Type getType() {
		return this.type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	@Column(name = "last_value", nullable = false)
	public Long getLastValue() {
		return this.lastValue;
	}

	public void setLastValue(Long lastValue) {
		this.lastValue = lastValue;
	}
}
